<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Page Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

</head>

<body>
    <div id="example-3">
        <button v-on:click="say('王杰崧大傻子')">王杰崧1</button>
        <button v-on:click="say('王杰崧大坏蛋')">王杰崧2</button>
        <button v-on:click="warn('Form cannot be submitted yet.', $event)">
          Submit
        </button>
    </div>
</body>
<script>
    var example = new Vue({
        el: "#example-3",
        methods: {
            say: function(message) {
                alert(message)
            },
            warn: function(message, event) {
                // 现在我们可以访问原生事件对象
                if (event) event.preventDefault()
                alert(message)
            }
        }
    })
</script>

</html>